<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
    <title>connect</title>
<link href="../../../../images/logo-icon.svg" rel="icon" type="image/svg"><script>var pathToRoot = "../../../../";</script>
    <script>document.documentElement.classList.replace("no-js", "js");</script>
    <script>const storage = localStorage.getItem("dokka-dark-mode")
      if (storage == null) {
        const osDarkSchemePreferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
        if (osDarkSchemePreferred === true) {
          document.getElementsByTagName("html")[0].classList.add("theme-dark")
        }
      } else {
        const savedDarkMode = JSON.parse(storage)
        if (savedDarkMode === true) {
          document.getElementsByTagName("html")[0].classList.add("theme-dark")
        }
      }
    </script>
<script type="text/javascript" src="https://unpkg.com/kotlin-playground@1/dist/playground.min.js" async></script>
<script type="text/javascript" src="../../../../scripts/sourceset_dependencies.js" async></script>
<link href="../../../../styles/style.css" rel="Stylesheet">
<link href="../../../../styles/main.css" rel="Stylesheet">
<link href="../../../../styles/prism.css" rel="Stylesheet">
<link href="../../../../styles/logo-styles.css" rel="Stylesheet">
<link href="../../../../ui-kit/ui-kit.min.css" rel="Stylesheet">
<script type="text/javascript" src="../../../../scripts/safe-local-storage_blocking.js"></script>
<script type="text/javascript" src="../../../../scripts/navigation-loader.js" async></script>
<script type="text/javascript" src="../../../../scripts/platform-content-handler.js" async></script>
<script type="text/javascript" src="../../../../scripts/main.js" defer></script>
<script type="text/javascript" src="../../../../scripts/prism.js" async></script>
<script type="text/javascript" src="../../../../ui-kit/ui-kit.min.js" defer></script></head>
<body>
<div class="root">
    <header class="navigation theme-dark" id="navigation-wrapper" role="banner">
<a class="library-name--link" href="../../../../index.html" tabindex="1">
                    exposed
            </a>        <button class="navigation-controls--btn navigation-controls--btn_toc ui-kit_mobile-only" id="toc-toggle" type="button">Toggle table of contents
        </button>
        <div class="navigation-controls--break ui-kit_mobile-only"></div>
        <div class="library-version" id="library-version">1.0.0-rc-4
        </div>
        <div class="navigation-controls">
        <ul class="filter-section filter-section_loading" id="filter-section" aria-label="Target filter">
                <button class="platform-tag platform-selector jvm-like" data-active="" aria-pressed="true" data-filter=":exposed-r2dbc/main">jvm</button>
            <div class="dropdown filter-section--dropdown" data-role="dropdown" id="filter-section-dropdown">
                <button class="button button_dropdown filter-section--dropdown-toggle" role="combobox" data-role="dropdown-toggle" aria-controls="platform-tags-listbox" aria-haspopup="listbox" aria-expanded="false" aria-label="Toggle source sets"></button>
                <ul role="listbox" id="platform-tags-listbox" class="dropdown--list" data-role="dropdown-listbox" aria-label="Target filter">
                    <div class="dropdown--header"><span>Target filter</span>
                        <button class="button" data-role="dropdown-toggle" aria-label="Close target filter">
                            <i class="ui-kit-icon ui-kit-icon_cross"></i>
                        </button>
                    </div>
                        <li role="option" class="dropdown--option platform-selector-option jvm-like" tabindex="0">
                            <label class="checkbox">
                                <input type="checkbox" class="checkbox--input" id=":exposed-r2dbc/main" data-filter=":exposed-r2dbc/main">
                                <span class="checkbox--icon"></span>
                                jvm
                            </label>
                        </li>
                </ul>
                <div class="dropdown--overlay"></div>
            </div>
        </ul>
            <button class="navigation-controls--btn navigation-controls--btn_theme" id="theme-toggle-button" type="button">Switch theme
            </button>
            <div class="navigation-controls--btn navigation-controls--btn_search" id="searchBar" role="button">Search in
                API
            </div>
        </div>
    </header>
    <div id="container">
        <nav id="leftColumn" class="sidebar" data-item-type="SECTION" data-item-config="{&quot;defaultSize&quot;: 280, &quot;minSize&quot;: 200, &quot;maxSize&quot;: 400}">
            <a class="toc--skip-link" href="#main">Skip to content</a>
            <div class="dropdown theme-dark_mobile" data-role="dropdown" id="toc-dropdown">
                <ul role="listbox" id="toc-listbox" class="dropdown--list dropdown--list_toc-list" data-role="dropdown-listbox" aria-label="Table of contents">
                    <div class="dropdown--header">
                            <span>
                                    exposed
                            </span>
                        <button class="button" data-role="dropdown-toggle" aria-label="Close table of contents">
                            <i class="ui-kit-icon ui-kit-icon_cross"></i>
                        </button>
                    </div>
                    <div class="sidebar--inner" id="sideMenu"></div>
                </ul>
                <div class="dropdown--overlay"></div>
            </div>
        </nav>
        <div id="resizer" class="resizer" data-item-type="BAR"></div>
        <div id="main" data-item-type="SECTION" role="main">
<div class="main-content" data-page-type="member" id="content" pageids="exposed-r2dbc::org.jetbrains.exposed.v1.r2dbc/R2dbcDatabase.Companion/connect/#kotlin.Function1[org.jetbrains.exposed.v1.r2dbc.R2dbcDatabase,org.jetbrains.exposed.v1.core.transactions.TransactionManagerApi]#kotlin.Function1[org.jetbrains.exposed.v1.r2dbc.R2dbcDatabaseConfig.Builder,kotlin.Unit]/PointingToDeclaration//876859814">
  <div class="breadcrumbs"><a href="../../../index.html">exposed-r2dbc</a><span class="delimiter">/</span><a href="../../index.html">org.jetbrains.exposed.v1.r2dbc</a><span class="delimiter">/</span><a href="../index.html">R2dbcDatabase</a><span class="delimiter">/</span><a href="index.html">Companion</a><span class="delimiter">/</span><span class="current">connect</span></div>
  <div class="cover ">
    <h1 class="cover"><span><span>connect</span></span></h1>
  </div>
  <div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":exposed-r2dbc/main"><div class="symbol monospace"><span class="token keyword">fun </span><a href="connect.html"><span class="token function">connect</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">manager<span class="token operator">: </span><span class="token punctuation">(</span><a href="../index.html">R2dbcDatabase</a><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="../../../../exposed-core/org.jetbrains.exposed.v1.core.transactions/-transaction-manager-api/index.html">TransactionManagerApi</a><span class="token operator"> = </span>{ TransactionManager(it) }<span class="token punctuation">, </span></span><span class="parameter ">databaseConfig<span class="token operator">: </span><a href="../../-r2dbc-database-config/-builder/index.html">R2dbcDatabaseConfig.Builder</a><span class="token punctuation">.</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html">Unit</a><span class="token operator"> = </span>{}</span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="../index.html">R2dbcDatabase</a></div><div class="symbol monospace"><span class="token keyword">fun </span><a href="connect.html"><span class="token function">connect</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">manager<span class="token operator">: </span><span class="token punctuation">(</span><a href="../index.html">R2dbcDatabase</a><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="../../../../exposed-core/org.jetbrains.exposed.v1.core.transactions/-transaction-manager-api/index.html">TransactionManagerApi</a><span class="token operator"> = </span>{ TransactionManager(it) }<span class="token punctuation">, </span></span><span class="parameter ">databaseConfig<span class="token operator">: </span><a href="../../-r2dbc-database-config/-builder/index.html">R2dbcDatabaseConfig.Builder</a><span class="token operator"> = </span>R2dbcDatabaseConfig.Builder()</span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="../index.html">R2dbcDatabase</a></div><p class="paragraph">Creates an <a href="../index.html">R2dbcDatabase</a> instance.</p><p class="paragraph"><strong>Note:</strong> This function does not immediately instantiate an actual connection to a database, but instead provides the details necessary to do so whenever a connection is required by a transaction.</p><h4 class="tableheader">Parameters</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>manager</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The <a href="../../../org.jetbrains.exposed.v1.r2dbc.transactions/-transaction-manager/index.html">TransactionManager</a> responsible for new transactions that use this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span>database</span><wbr><span><span>Config</span></span></u></div></span></div><div><div class="title"><p class="paragraph">Builder of configuration parameters for this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div></div><h4 class="tableheader">Throws</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html"><span>Illegal</span><wbr><span>State</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">If a corresponding database dialect cannot be resolved from values provided to <a href="connect.html">databaseConfig</a>.</p></div></div></div></div></div><hr><div class="symbol monospace"><span class="token keyword">fun </span><a href="connect.html"><span class="token function">connect</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">connectionFactory<span class="token operator">: </span><span data-unresolved-link="io.r2dbc.spi/ConnectionFactory///PointingToDeclaration/">ConnectionFactory</span><span class="token punctuation">, </span></span><span class="parameter ">databaseConfig<span class="token operator">: </span><a href="../../-r2dbc-database-config/-builder/index.html">R2dbcDatabaseConfig.Builder</a><span class="token punctuation">, </span></span><span class="parameter ">manager<span class="token operator">: </span><span class="token punctuation">(</span><a href="../index.html">R2dbcDatabase</a><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="../../../../exposed-core/org.jetbrains.exposed.v1.core.transactions/-transaction-manager-api/index.html">TransactionManagerApi</a><span class="token operator"> = </span>{ TransactionManager(it) }</span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="../index.html">R2dbcDatabase</a></div><p class="paragraph">Creates an <a href="../index.html">R2dbcDatabase</a> instance.</p><p class="paragraph"><strong>Note:</strong> This function does not immediately instantiate an actual connection to a database, but instead provides the details necessary to do so whenever a connection is required by a transaction.</p><h4 class="tableheader">Parameters</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span>connection</span><wbr><span><span>Factory</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The <span data-unresolved-link="io.r2dbc.spi/ConnectionFactory///PointingToDeclaration/">ConnectionFactory</span> entry point for an R2DBC driver when getting a connection.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>manager</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The <a href="../../../org.jetbrains.exposed.v1.r2dbc.transactions/-transaction-manager/index.html">TransactionManager</a> responsible for new transactions that use this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span>database</span><wbr><span><span>Config</span></span></u></div></span></div><div><div class="title"><p class="paragraph">Configuration parameters for this <a href="../index.html">R2dbcDatabase</a> instance. At minimum, a value for <code class="lang-kotlin">explicitDialect</code> must be provided to prevent throwing an exception.</p></div></div></div></div></div><h4 class="tableheader">Throws</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html"><span>Illegal</span><wbr><span>State</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">If a corresponding database dialect cannot be resolved from the <a href="connect.html">connectionFactory</a> or from values provided to <a href="connect.html">databaseConfig</a>.</p></div></div></div></div></div><hr><div class="symbol monospace"><span class="token keyword">fun </span><a href="connect.html"><span class="token function">connect</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">url<span class="token operator">: </span><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html">String</a><span class="token punctuation">, </span></span><span class="parameter ">driver<span class="token operator">: </span><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html">String</a><span class="token operator"> = </span>getDriver(url)<span class="token punctuation">, </span></span><span class="parameter ">user<span class="token operator">: </span><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html">String</a><span class="token operator"> = </span><span class="token string">""</span><span class="token punctuation">, </span></span><span class="parameter ">password<span class="token operator">: </span><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html">String</a><span class="token operator"> = </span><span class="token string">""</span><span class="token punctuation">, </span></span><span class="parameter ">manager<span class="token operator">: </span><span class="token punctuation">(</span><a href="../index.html">R2dbcDatabase</a><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="../../../../exposed-core/org.jetbrains.exposed.v1.core.transactions/-transaction-manager-api/index.html">TransactionManagerApi</a><span class="token operator"> = </span>{ TransactionManager(it) }<span class="token punctuation">, </span></span><span class="parameter ">databaseConfig<span class="token operator">: </span><a href="../../-r2dbc-database-config/-builder/index.html">R2dbcDatabaseConfig.Builder</a><span class="token operator"> = </span>R2dbcDatabaseConfig.Builder()</span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="../index.html">R2dbcDatabase</a></div><p class="paragraph">Creates an <a href="../index.html">R2dbcDatabase</a> instance.</p><p class="paragraph"><strong>Note:</strong> This function does not immediately instantiate an actual connection to a database, but instead provides the details necessary to do so whenever a connection is required by a transaction.</p><h4 class="tableheader">Parameters</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>url</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The URL that represents the database when getting a connection.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>driver</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The R2DBC driver class. If not provided, the specified <a href="connect.html">url</a> will be used to find a match from the existing driver mappings.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>user</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The database user that owns the new connections.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>password</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The password specific for the database <a href="connect.html">user</a>.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span>database</span><wbr><span><span>Config</span></span></u></div></span></div><div><div class="title"><p class="paragraph">Configuration parameters for this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>manager</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The <a href="../../../org.jetbrains.exposed.v1.r2dbc.transactions/-transaction-manager/index.html">TransactionManager</a> responsible for new transactions that use this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div></div><h4 class="tableheader">Throws</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html"><span>Illegal</span><wbr><span>State</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">If a corresponding database dialect cannot be resolved from the provided <a href="connect.html">url</a>.</p></div></div></div></div></div><hr><div class="symbol monospace"><span class="token keyword">fun </span><a href="connect.html"><span class="token function">connect</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">databaseConfig<span class="token operator">: </span><a href="../../-r2dbc-database-config/index.html">R2dbcDatabaseConfig</a><span class="token punctuation">, </span></span><span class="parameter ">manager<span class="token operator">: </span><span class="token punctuation">(</span><a href="../index.html">R2dbcDatabase</a><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="../../../../exposed-core/org.jetbrains.exposed.v1.core.transactions/-transaction-manager-api/index.html">TransactionManagerApi</a><span class="token operator"> = </span>{ TransactionManager(it) }</span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="../index.html">R2dbcDatabase</a></div><p class="paragraph">Creates an <a href="../index.html">R2dbcDatabase</a> instance.</p><p class="paragraph"><strong>Note:</strong> This function does not immediately instantiate an actual connection to a database, but instead provides the details necessary to do so whenever a connection is required by a transaction.</p><h4 class="tableheader">Parameters</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span>database</span><wbr><span><span>Config</span></span></u></div></span></div><div><div class="title"><p class="paragraph">Configuration parameters for this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><u><span><span>manager</span></span></u></div></span></div><div><div class="title"><p class="paragraph">The <a href="../../../org.jetbrains.exposed.v1.r2dbc.transactions/-transaction-manager/index.html">TransactionManager</a> responsible for new transactions that use this <a href="../index.html">R2dbcDatabase</a> instance.</p></div></div></div></div></div><h4 class="tableheader">Throws</h4><div class="table"><div class="table-row table-row_content" data-filterable-current=":exposed-r2dbc/main" data-filterable-set=":exposed-r2dbc/main"><div class="main-subrow keyValue "><div class=""><span class="inline-flex"><div><a href="https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html"><span>Illegal</span><wbr><span>State</span><wbr><span><span>Exception</span></span></a></div></span></div><div><div class="title"><p class="paragraph">If a corresponding database dialect cannot be resolved from the provided <a href="connect.html">databaseConfig</a>.</p></div></div></div></div></div></div></div>
</div>
    <div class="footer">
        <div class="footer--container">
            <a href="#content" id="go-to-top-link" class="footer--button footer--button_go-to-top"></a>
            <div class="footer--content">
                <div>
                    <span>Generated by </span>
                    <a class="footer--link footer--link_external" href="https://github.com/Kotlin/dokka">
                        Dokka
                    </a>
                    <div>© 2025 Copyright</div>
                </div>
            </div>
        </div>
    </div>
        </div>
    </div>
</div>
</body>
</html>